package cn.wyl.service.impl;

import cn.wyl.domain.Course;
import cn.wyl.mapper.CourseMapper;
import cn.wyl.service.ICourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class CourseServiceImpl implements ICourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Value("${server.port}")
    private String port;

    @Override
    public void save(Course course) {
        courseMapper.save(course);
    }

    @Override
    public Course loadById(Long id) {

        Course course = courseMapper.loadById(id);
        course.setName(course.getName()+":"+port);
        return course;
    }

    @Override
    public void upd(Course course) {
        courseMapper.upd(course);
    }
}
